<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
       var str = 'dkfdjkhfgdpkgpsd'
       var obj = {}
       for (var i = 0; i < str.length; i++) {
        var s = str.charAt(i)
        if(obj[s]) {
            obj[s]++
        }else {
            obj[s] = 1
        }
       }
       var ch = '';
       var max = 0
       for(k in obj) {
        if (obj[k] > max) {
            max = obj[k]
            ch = k
        }
       }
       console.log(max)
       console.log(ch)
    </script>
</head>

<body>

</body>

</html>